home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
DEMON
/
UTILS
/
BUD.ARC
/
c
/
main
< prev
Wrap
Text File
|
1996-06-12
|
3KB
|
102 lines
/************************************************************
* BUD *
* *
* Quick UU Decoder *
* *
* Emphasis on re-organising articles by file and part. *
* *
************************************************************
* *
* File: main.c *
* Author: Kevin F. Quinn (C) February 1995 *
* *
* Revision History *
* *
* Owner | Date | Issue | Comments *
* ------+----------+-------+------------------------------ *
* KFQ | 08/02/95 | 0.01 | Initial issue *
* KFQ | 12/06/95 | 0.10 | First release *
* *
************************************************************/
#define _main
#include <stdio.h>
#include "bud.h"
/* Main program
* ==> Help on keyword bud
* *Bud decodes one or more files containing uuencoded data, taking
* account of multiple-part headers in network news style.
* Syntax: BUD [<options>] <file spec> [<file spec> [<file spec>...]]
* Options:
* -v Verbose messages on
* -d Debugging on
* -w Write new ordered file (don't uudecode)
*
* Decodes to &.oupt.bud<n>.*
* Filenames "." changed to "/"; files already existing are not
* overwritten and duplicate filenames are resolved by overwriting initial
* characters to hack out ambiguity. Writes mapping from original
* filename to hacked filename to &.outputref.
*/
static void syntax(char c)
{
fprintf(stderr, "Bad option %c.\n", c);
fprintf(stderr, "Syntax: BUD [-d] [-v] [-w file] file [file [file...]]\n");
}
int main(int argc, char **argv)
{
bud_debug=BUD_FALSE;
bud_verbose=BUD_FALSE;
bud_write=BUD_FALSE;
bud_write_file=NULL;
bud_decode=BUD_TRUE;
argv++; argc--;
while (argc>0) {
switch ((*argv)[0])
{
case '-':
switch ((*argv)[1]) {
case 'd':
case 'D':
bud_debug=BUD_TRUE;
(void) fprintf(stderr, "Debugging on\n");
break;
case 'w':
case 'W':
if (argc>0)
{
bud_write=BUD_TRUE;
(void) fprintf(stderr, "Will generate ordered version on\n");
bud_decode=BUD_FALSE;
bud_write_file=*(++argv);
--argc;
}
else
{
syntax((*argv)[1]);
return(-1);
}
break;
case 'v':
case 'V':
bud_verbose=BUD_TRUE;
(void) fprintf(stderr, "Verbose reporting on\n");
break;
default:
syntax((*argv)[1]);
return(-1);
}
argv++; argc--;
break;
default:
bud(argc, argv);
argc=0;
}
}
return(0);
}